package com.ima.web.common.controllers;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;

import com.ima.web.service.CategoriesService;
import com.ima.web.service.StoriesService;
import com.ima.web.service.SubCategoriesService;

@Controller
@RequestMapping("/user")
public class AuthedUserController {
	
	private StoriesService storiesService;
	private CategoriesService categoriesService;
	private SubCategoriesService subCategoriesService;
	
	@Autowired
	public void setDependencies(StoriesService storiesService,
								CategoriesService categoriesService,
								SubCategoriesService subCategoriesService){
		this.storiesService = storiesService;
		this.categoriesService = categoriesService;
		this.subCategoriesService = subCategoriesService;
	}
	
	@RequestMapping("/story/create")
	public String createStory(ModelMap model){
		model.put("categories",categoriesService.getApproved());
		model.put("subcategories",subCategoriesService.getApproved());
		return "user/story/create";
	}
	
	@RequestMapping("/story/create/save")
	public String saveStory(ModelMap model){
		
		
		return "user/story/create";
	}

}
